<template>
  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose title="部门处理情况" :width="800">
    <BasicTable @register="registerTable">
      <template #tableTitle>
        <div>配合部门处理情况列表</div>
      </template>
    </BasicTable>
  </BasicModal>
</template>

<script lang="ts" setup>
import { ref, unref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table';
import { peihebumenchuliqingkuang } from '../Yuedupeihebumenbiao.api';

const id = ref('');
const currentRecord = ref<any>(null);

// 表格配置
const columns = [
  {
    title: '配合部门',
    align: "center",
    dataIndex: 'peihebumen_dictText',
  },
  {
    title: '协作内容',
    align: "center",
    dataIndex: 'xiezuoneirong',
  },
  {
    title: '质量要求',
    align: "center",
    dataIndex: 'zhiliangyaoqiu',
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'zhuangtai',
  }
];

const [registerTable, { reload }] = useTable({
  api: peihebumenchuliqingkuang,
  columns,
  showActionButtonGroup: false,
  beforeFetch: (params) => {
    const record = unref(currentRecord);
    return { ...params, ...record };
  }
});

// 弹窗配置
const [registerModal] = useModalInner((data) => {
  currentRecord.value = {...data.record};
  reload();
});
</script>
